package com.party.course.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.party.course.mapper.StoreGroupInfoMapper;
import com.party.course.domain.StoreGroupInfo;
import com.party.course.service.IStoreGroupInfoService;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import com.party.common.utils.SecurityUtils;

/**
 * 门店小组关联Service业务层处理
 *
 * @author ruoyi
 * @date 2025-05-29
 */
@Service
public class StoreGroupInfoServiceImpl extends ServiceImpl<StoreGroupInfoMapper, StoreGroupInfo> implements IStoreGroupInfoService {
    @Autowired
    private StoreGroupInfoMapper storeGroupInfoMapper;

    /**
     * 查询门店小组关联
     *
     * @param id 门店小组关联主键
     * @return 门店小组关联
     */
    @Override
    public StoreGroupInfo view(String id) {
        return storeGroupInfoMapper.selectStoreGroupInfoById(id);
    }

    /**
     * 查询门店小组关联列表
     *
     * @param storeGroupInfo 门店小组关联
     * @return 门店小组关联
     */
    @Override
    public List<StoreGroupInfo> findList(StoreGroupInfo storeGroupInfo) {
        return storeGroupInfoMapper.selectStoreGroupInfoList(storeGroupInfo);
    }

    /**
     * 新增门店小组关联
     *
     * @param storeGroupInfo 门店小组关联
     * @return 结果
     */
    @Override
    public int add(StoreGroupInfo storeGroupInfo) {
        storeGroupInfo.setId(IdUtil.simpleUUID());
        storeGroupInfo.setDelFlag("0");
        return storeGroupInfoMapper.insert(storeGroupInfo);
    }

    /**
     * 修改门店小组关联
     *
     * @param storeGroupInfo 门店小组关联
     * @return 结果
     */
    @Override
    public int updateEntity(StoreGroupInfo storeGroupInfo) {
        storeGroupInfo.setUpdateTime(DateUtil.date());
        return storeGroupInfoMapper.updateById(storeGroupInfo);
    }

    /**
     * 批量删除门店小组关联
     *
     * @param ids 需要删除的门店小组关联主键
     * @return 结果
     */
    @Override
    public int deleteIds(List<String> ids) {
        return storeGroupInfoMapper.deleteStoreGroupInfoByIds(ids);
    }

    /**
     * 删除门店小组关联信息
     *
     * @param id 门店小组关联主键
     * @return 结果
     */
    @Override
    public int deleteById(String id) {
        return storeGroupInfoMapper.deleteStoreGroupInfoById(id);
    }
}
